package com.yihong.userserver.configuration;

import com.github.pagehelper.PageHelper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Properties;

@Configuration
public class PageHelperConfiguration {


    /**
      * 配置mybatis的分页插件pageHelper
      * @return com.github.pagehelper.PageHelper
      * @author 孟志浩
      * @date 2019/4/2
      **/
    @Bean
    public PageHelper pageHelper(){
        PageHelper pageHelper = new PageHelper();
        Properties properties = new Properties();
        properties.setProperty("offsetAsPageNum","true");
        properties.setProperty("rowBoundsWithCount","true");
        properties.setProperty("reasonable","true");
        properties.setProperty("dialect","sqlserver2012");
        pageHelper.setProperties(properties);
        return pageHelper;
    }

}
